﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Media;
using agsXMPP;
using agsXMPP.protocol.client;
using Mammoth.Services;

namespace Mammoth.Entities
{
    public enum AccountState
    {
        Logoff, Login, Busy
    }

    public class AccountEntity : Entity, IGTalkAccountEntity
    {
        public AccountEntity() : base() { }

        public AccountEntity(string serviceEmail)
            : base()
        {
            Email = serviceEmail;
            PresenceType = PresenceType.available;
            State = AccountState.Logoff;
        }

        public virtual AccountState State { get; set; }
        public virtual bool IsAutoLogin { get; set; }
        public virtual string Email { get; set; }
        public virtual string Password { get; set; }
        public virtual PresenceType PresenceType { get; set; }
        public virtual ImageSource Avatar { get; set; }
        public virtual string Name { get; set; }
        public virtual string Status { get; set; }
        public virtual IList<OutboxEntity> Outbox { get; set; }
        public virtual IList<InboxEntity> Inbox { get; set; }

        public static explicit operator AccountEntity(GTalkAccountConfigElement element)
        {
            return new AccountEntity() { Email = element.Email, Password = element.Password, IsAutoLogin = element.IsAutoLogin };
        }

        public static explicit operator GTalkAccountConfigElement(AccountEntity entity)
        {
            return new GTalkAccountConfigElement() { Email = entity.Email, Password = entity.Password, IsAutoLogin = entity.IsAutoLogin };
        }


    }
}
